package com.jpa.dao;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.jpa.pojo.User;


@Repository
public interface UserDao extends BaseDao<User, Long> {
	 
	User findByUsername(String username);
	/**
	 * 授权用户角色
	 */
	@Transactional
	@Modifying
	@Query(value = "INSERT INTO user_role (uid,rid) VALUES (:uid,:rid)", nativeQuery = true)
    void authUserRoles(@Param(value = "uid") long uid,@Param(value = "rid") long rid);
}
